CHARTS
Photo by Taiki Ishikawa on Unsplash
Robots will harvest, cook, and serve our food.
They will work in our factories, drive our cars, and walk our dogs.
Like it or not, the age of work is coming to an end…
— Gray Scott
# file path parameter
df_file_path <- "archetypes/job-automation/job-automation.csv"
df <- read.csv(df_file_path, header = TRUE, stringsAsFactors = FALSE)
df
df_wrangle <- df %>% select(prob, Average_annual_wage, education, short_occupation, numbEmployed)
df_wrangle <- df_wrangle[order(df_wrangle$numbEmployed, decreasing = TRUE),]
df_wrangle
theme_opts <- theme(
text = element_text(family = "inconsolata"),
plot.title = element_text(color = "black", size = 14, face = "bold"),
plot.subtitle = element_text(color = "black", size = 12),
plot.caption = element_text(color = "#555555", size = 8),
# axis.title.x = element_blank(),
# axis.title.y = element_blank(),
# axis.text.x = element_text(vjust = 12),
panel.border = element_blank(),
panel.background = element_blank(),
panel.grid.minor = element_blank(), # remove minor gridlines
# panel.grid.major.x = element_blank(), # remove x (vertical) gridlines
# panel.grid.major.y = element_blank(), # remove y (horizontal) gridlines
legend.title = element_blank(), # remove legend title
# legend.text = element_text(color = "black", size = 8),
legend.position='none'
)
education_palette <- c(
"High school diploma or equivalent" = "#d49a5e",
"Bachelor's degree" = "#61a46c",
"Postsecondary nondegree award" = "#f1d517",
"Associate's degree" = "#61a46c",
"No formal educational credential" = "#c6553c",
"Doctoral or professional degree" = "#5080a2"
)
v1 <- ggplot(data = df_wrangle, aes(x = prob, y = Average_annual_wage)) +
geom_point(aes(size = numbEmployed, fill = education),
shape = 21, color = "#FFFFFF", stroke = 1.0, alpha = 0.7) +
scale_x_continuous() +
scale_y_continuous(breaks = seq(0, 300000, 25000), labels = scales::dollar) +
scale_fill_manual(values = education_palette) +
# scale_size_area(max_size = 10) +
scale_size(range = c(2, 15)) +
labs(title = "Job Automation",
subtitle = "color by education level, sized by number employed",
x = 'less likely <- probability of automation -> most likely',
y = 'average annual wage',
caption = "Source:Transit Costs Project")+
theme_minimal() +
theme_opts
girafe(ggobj = v1, width_svg = 16, height_svg = 12,
options = list(opts_sizing(rescale = TRUE, width = 0.8)))
label_list <- c(
"Orthodonists",
"Dentists",
"Airline Pilots, Copilots and Flight Engineers",
"Podiatrists",
"Preschool Teachers",
"Recreation Workers",
"Animal Control Workers",
"Ambulance Drivers and Attendants",
"Radiation Therapists",
"Judges",
"Home Health Aides",
"Shoe and Leather Workers and Repairers",
"Financial Advisors",
"Geoscientists",
"Cooks, Fast Food",
"Food Preparation & Serving Workers",
"Nuclear Technicians",
"Benefits Managers",
"Insurance Underwriters",
"Sewers, Hand"
)
df_labels <- filter(df_wrangle, short_occupation %in% label_list)
df_labels
v2 <- v1 +
geom_text_repel(data=df_labels, aes(label = short_occupation), box.padding = 0.75, direction = "y", min.segment.length = 0.0, nudge_y = 0.75, point.padding = 0.5, family = "inconsolata")
girafe(ggobj = v2, width_svg = 16, height_svg = 12,
options = list(opts_sizing(rescale = TRUE, width = 0.8)))